/*
 *  $Id: SkyStream.cs 972 2009-12-15 16:53:41Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008-2009 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Cards001.Water.Spells {
    public class SkyStream: TargetEnchantmentCard<Creature> {
        public SkyStream(): base("001_w_s_sky_stream") {
            Level = CompleteLevel.ReadyForTest;
            Version = 1;
            Element = ElementType.Water;
            Value = 100;
            Target = new CreatureTarget(GetTargetPhrase(), true, true, CreatureTarget.IsAquatic);
        }

        protected override bool IsPossibleAction(TargetArgs<Creature> args) {
            int mana = args.Target.Card.GetSumMana();
            if (mana >= args.Player.GetMana(ElementType.Water)) {
                args.Player.Game.ErrorNotice(ManaCondition.NotEnough.GetText(ElementType.Water));
                return false;
            }
            return true;
        }

        protected override void DoAction(TargetArgs<Creature> args) {
            args.Player.DecrementMana(ElementType.Water, args.Target.Card.GetSumMana());
            base.DoAction(args);
        }

        protected override EnchantmentAffect CreateEnchantment () {
            return new SkyStreamAffect();
        }

        private class SkyStreamAffect: EnchantmentAffect<SkyStream> {
            public SkyStreamAffect() {
                Add(new Affects.Flight());
                Add(new Affects.Deluge());
            }
        }
    }
}
